package com.example.test_app

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentPagerAdapter
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager

class VpActivity : AppCompatActivity() {

    var pageList = ArrayList<Fragment>()
    var pageList2 = ArrayList<Fragment>()
    var vp: ViewPager? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_vp)
        vp = findViewById(R.id.vp)
        pageList.add(VpFragment())
        pageList.add(BlankFragment2())
        pageList2.add(BlankFragment2())
        pageList2.add(BlankFragment2())
        vp?.adapter = object : FragmentPagerAdapter(supportFragmentManager) {
            override fun getCount(): Int {
                return pageList.size
            }

            override fun getItem(position: Int): Fragment {
                return pageList[position]
            }

        }


//        val vp2 = findViewById<ViewPager>(R.id.vp2)

//        vp2.adapter = object : FragmentPagerAdapter(supportFragmentManager) {
//            override fun getCount(): Int {
//                return pageList2.size
//            }
//
//            override fun getItem(position: Int): Fragment {
//                return pageList2[position]
//            }
//
//        }


    }
}